const dataKit = require( "./dataKit")
const dateKit = require( "./dateKit");
const util = require( "./util");

/**
 * 注意：使用await的方法必须加上async，不然会报错！！
 */
module.exports = {
  /**
    * 根据openId获取商户
    * @param {*} openId 商户的openid
    */
   async getMerchantByOpenId(context,openId){
      if(!openId){
         console.info("getMerchantByOpenId --> openId是必须的");
         return null;
      }
      //过滤条件
      const filter = {openId: openId};
      let merchant =await dataKit.findOne(context,"merchant",filter);
      return merchant;
   }
}